Populate the ':title' in EWW when defaulting to readable mode
authorJim Porter <jporterbugs@gmail.com>
Thu, 19 Jun 2025 19:23:24 +0000 (12:23 -0700)
committerJim Porter <jporterbugs@gmail.com>
Sun, 29 Jun 2025 17:08:21 +0000 (10:08 -0700)
Do not merge to master.

* lisp/net/eww.el (eww-display-document): Always render the full
document first to populate ':title' (bug#77299).

lisp/net/eww.el

index c3e927b74a6559980872ef3ed96aac71149ba467..0bf7fe5f307c21f4f2d763073c4f8628ac85ca29 100644 (file)
@@ -828,6 +828,12 @@ This replaces the region with the preprocessed HTML."
   (unless document
     (let ((dom (eww--parse-html-region (point) (point-max) charset)))
       (when (eww-default-readable-p url)
+        ;; HACK: Work around bug#77299.  By displaying the full
+        ;; document first, we can ensure that the `:title' property in
+        ;; `eww-data' gets set properly.  This is inefficient, since
+        ;; it requires rendering the document twice.
+        (let ((shr-inhibit-images t))
+          (eww-display-document (eww-document-base url dom) point buffer))
         (eww-score-readability dom)
         (setq dom (eww-highest-readability dom))
         (with-current-buffer buffer